<template>
    <div>
        <!-- 到账确认 -->
        <policy-list v-if="show" :type="'到账确认'" @goFinace="goFinace" ref="list">
        </policy-list>
        <el-dialog title="到账确认" :visible.sync="finace" v-if="finace" size="tiny">

            <el-form ref="form" label-width="80px">
                <el-form-item label="到账时间">
                    <el-date-picker type="date" placeholder="选择日期" v-model="time" ></el-date-picker>
                </el-form-item>
                <el-form-item  style="text-align:center">
                    <el-button type="primary" @click="onSubmit">提交</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
import PolicyList from "@/components/Sell/PolicyList";
import api from "@/js/api";
export default {
  data() {
    return {
      show: false,
      finace: false,
      time: "",
      id: ""
    };
  },
  components: {
    "policy-list": PolicyList
  },
  methods: {
    goFinace(id) {
      this.finace = true;
      this.id = id;
    },
    onSubmit() {
      // console.log(this.time);
      if (!this.time) {
        this.$notify({
          title: "信息不完整",
          message: "请填写到账时间",
          type: "warning"
        });
        return;
      }
      var data = {
        SALESDETAIL_ID: this.id,
        SALESDETAIL_CHECKSTATE: "需保险单上传",
        SALESDETAIL_MONEYTIME: this.time
      };
      let that = this;
      api.SaledetailUpdatePart(that, data, function(msg) {
        that.close();
      });
    },
    close() {
      try {
        this.$refs.list.getDate();
        this.finace = false;
      } catch (error) {}
    }
  },
  activated() {
    this.show = true;
    try {
      this.$refs.list.getDate();
    } catch (error) {}
  }
};
</script>

<style>

</style>
